import { IPSDEEditFormParam } from './ipsdeedit-form-param';
import { IPSDEWizardEditFormParam } from './ipsdewizard-edit-form-param';
import { PSDEFormParamImpl } from './psdeform-param-impl';
import { IPSDEWizardForm } from '../../dataentity/wizard/ipsdewizard-form';

export class PSDEEditFormParamImpl extends PSDEFormParamImpl implements IPSDEEditFormParam, IPSDEWizardEditFormParam {
  protected psdewizardform: IPSDEWizardForm | null = null;

  getPSDEWizardForm(): IPSDEWizardForm | null {
    if (this.psdewizardform != null) return this.psdewizardform;
    const value = this.M.getPSDEWizardForm;
    if (value == null) {
      return null;
    }
    this.psdewizardform = this.getPSModel4('dataentity.wizard.IPSDEWizardForm', value, 'getPSDEWizardForm') as IPSDEWizardForm;
    return this.psdewizardform;
  }

  get psDEWizardForm(): IPSDEWizardForm | null {
    return this.getPSDEWizardForm();
  }

  getPSDEWizardFormMust(): IPSDEWizardForm {
    const value = this.getPSDEWizardForm();
    if (value == null) {
      throw new Error('未指定向导表单');
    }
    return value;
  }

  get enableAutoSave(): boolean {
    return this.M.enableAutoSave;
  }

  get cls(): string {
    return 'PSDEEditFormParamImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.IPSSDAjaxControlParam' || cls == 'control.form.IPSDEEditFormParam' || cls == 'control.form.IPSDEWizardEditFormParam') return true;
    return super.instanceof(cls);
  }
}
